#include "stdafx.h"
#include "span.h"
#include "drawing.h"

span16 * span16_create()
{
	span16 * span = new span16;
	span->x = I16_MIN;
	span->index = 0;
	span->covers = 0;
	return span;
}
void span16_destroy(span16 * psp)
{
	delete psp;
}


void span16_add(span16 * psp, uint_8 cover)
{
	if(psp->index == psp->count)
	{
		int_16 count = psp->count + 256;
		uint_8 * covers = new uint_8[count];
		memcpy_s(covers, count * sizeof(uint_8), psp->covers, psp->index * sizeof(uint_8));
		delete[] psp->covers;
		psp->covers = covers;
		psp->count = count;
	}
	psp->covers[psp->index ++] = cover;
}